// "use client"
import { maintenanceNoticeFlag } from '@/lib/edge-flags';
import DashboardLayoutContent from '@/components/dashboard/layout-content';
import { cookies } from 'next/headers';
import ConditionalSidebar from '@/components/dashboard/conditional-sidebar';

interface DashboardLayoutProps {
  children: React.ReactNode;
}

const getMaintenanceNotice = async () => {
  const maintenanceNotice = await maintenanceNoticeFlag();
  return maintenanceNotice;
};

export default async function DashboardLayout({
  children,
}: DashboardLayoutProps) {
  await cookies();
  const maintenanceNotice = await getMaintenanceNotice();
  return (
    <DashboardLayoutContent maintenanceNotice={maintenanceNotice}>
      <div className="flex h-full">
        <ConditionalSidebar />
        <main className="flex-1 overflow-auto">{children}</main>
      </div>
    </DashboardLayoutContent>
  );
}
